<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
    <xsl:template match="/tracks">
        <kml xmlns="http://earth.google.com/kml/2.1">
            <Style id="line">
                <LineStyle>
                    <color>ff0000ff</color>
                    <width>1.5</width>
                </LineStyle>
            </Style>
            <Document>
                <name>tracks.kml</name>
                <Folder>
                    <name>Tracks</name>
                    <open>1</open>
                    <xsl:for-each select="track">
                        <Placemark>
                            <name>
                                <xsl:value-of select="@name"/>
                            </name>
                            <styleUrl>#line</styleUrl>
                            <LineString>
                                <coordinates>
                                    <xsl:for-each select="point">
                                        <xsl:value-of select="lon"/>,<xsl:value-of select="lat"/>
                                        <xsl:text>                                       
                                        </xsl:text>
                                    </xsl:for-each>
                                </coordinates>
                            </LineString>
                        </Placemark>
                    </xsl:for-each>
                </Folder>
            </Document>
        </kml>
    </xsl:template>
</xsl:stylesheet>
